<?

  error_reporting(E_ALL);
  ini_set('display_errors', 1);

if (empty($_POST['id'])) {
  header('Location: dashboard.php');
}

include_once 'controller.inc.php';

$id = $_POST['id'];

$db_link = db_connect();

$event = db_getEvent($id);
db_deleteEvent($event);

$roles = db_getRolesForEvent($event);
foreach ($roles as $role) {
  db_deleteRole($role);
}

db_disconnect($db_link);

header('Location: dashboard.php?success=Event_deleted');

?>
